package com.yurun.mapper;

import com.yurun.entity.Article;
import com.yurun.model.vo.article.ArticleInfo;
import com.yurun.model.vo.CategoryArticleCount;
import com.yurun.model.vo.article.ArticleInfoArticleshow;
import com.yurun.model.vo.article.ArticleInfoHomeshow;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ArticleMapper {
    // === insert [article] ===
    int addArticle(Article article);

    // === delete [article] ===
    int deleteArticleById(Long id);

    // === update Article ===
    int updateArticleTopById(Long id,Boolean isTop);

    int updateArticleViewsById(Long id,Integer views);

    int updateArticle(Article article);

    // === select Article ===

    // --- select a part information of Article ---
     List<ArticleInfo> getAllArticleInfoList();                     // -- 用于后台-文章管理 页面

     List<ArticleInfo> getArticleInfoListByCategory(Integer category_id);

     List<ArticleInfo> getArticleInfoListByTitle(String title);

     List<ArticleInfoHomeshow> getArticleInfoHomeshowList();        // -- 用于第一级页面文章信息搜索

     List<ArticleInfoArticleshow> getArticleInfoArticleshowList();  // -- 用于第二季页面文章信息搜索

     // --- select other information of article
    List<String> getGroupYearMonthList();

    // --- select other ---
    List<ArticleInfoArticleshow> getArticleListByCategory(Integer category_id);

    Article getArticleById(Integer id);                                   // -- 获取文章内容

    int getCountOfArticle();

    int getCountOfArticleByCategoryId(Integer categoryId);

    List<CategoryArticleCount> getCountListOfArticleAboutCategory();// -- 获取每个分类名下的文章数量

}
